import java.util.List;

public class Question {
    private int id;
    private int examId;
    private String questionType; // single_choice, multiple_choice, true_false, fill_blank, essay
    private String questionText;
    private int questionOrder;
    private double score;
    private String correctAnswer; // 新增：用于判断题和填空题的正确答案
    private List<QuestionOption> options;

    public Question() {
    }

    public Question(int id, String questionType, String questionText,
            int questionOrder, double score) {
        this.id = id;
        this.questionType = questionType;
        this.questionText = questionText;
        this.questionOrder = questionOrder;
        this.score = score;
    }

    // Getters and Setters
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getExamId() {
        return examId;
    }

    public void setExamId(int examId) {
        this.examId = examId;
    }

    public String getQuestionType() {
        return questionType;
    }

    public void setQuestionType(String questionType) {
        this.questionType = questionType;
    }

    public String getQuestionText() {
        return questionText;
    }

    public void setQuestionText(String questionText) {
        this.questionText = questionText;
    }

    public int getQuestionOrder() {
        return questionOrder;
    }

    public void setQuestionOrder(int questionOrder) {
        this.questionOrder = questionOrder;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public String getCorrectAnswer() {
        return correctAnswer;
    }

    public void setCorrectAnswer(String correctAnswer) {
        this.correctAnswer = correctAnswer;
    }

    public List<QuestionOption> getOptions() {
        return options;
    }

    public void setOptions(List<QuestionOption> options) {
        this.options = options;
    }

    public boolean isChoiceQuestion() {
        return "single_choice".equals(questionType) || "multiple_choice".equals(questionType);
    }

    public boolean isTrueFalseQuestion() {
        return "true_false".equals(questionType);
    }

    public boolean isFillBlankQuestion() {
        return "fill_blank".equals(questionType);
    }

    public boolean isEssayQuestion() {
        return "essay".equals(questionType);
    }
}